<html lang="en"><head>
    <meta charset="UTF-8">
    <title>课程直播</title>
    <link rel="stylesheet" href="/live/css/oldstyle.css?v=3" type="text/css">
    <link rel="stylesheet" href="/live/css/reset.css" type="text/css">
    <script src="/js/jquery-1.9.0.min.js?v=3"></script>
    <style>
        .bnt_input_bc, .bnt_input_qx {
            width: 100px;
            height: 26px;
            line-height: 26px;
            text-align: center;
            border: solid #FFF 2px;
            border-radius: 2px;
            font-size: 14px;
            display: inline-block;
            margin: 0 812px;
            cursor: pointer;
            background-color: #26835c;
            color: #FFFFFF;
        }
    </style>
    <script>
        $(function () {
            reloadStream()
            $.ajax({
                url: '/frontLive/saveViewLiveCount',
                type: 'post',
                data: {"workDetailId": '2743280', "isStudent": ''},
                success: function (data) {

                }
            })
            $.ajax({
                url: '/live/listSignleCourse',
                type: 'post',
                dataType: 'json',
                data: {"liveId": '12073438', "fid": '16820', "uId": '334850241'},
                success: function (data) {
                    var tb = "";
                    if (data.length > 0) {
                        $.each(data, function (i, n) {
                            tb += "<li>";
                            tb += "<p class='fl'>第" + n.days + "周：周" + n.weekDay + " ： 第" + n.jie + "节：" + n.courseName + "</p>";
                            tb += "<div class='fr'>";
                            if (n.lectureStatus > 0) {
                                if (n.lectureStatus == 0 || n.lectureStatus == 1) {
                                    tb += "<i style='margin-left:50px;'>未评</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                } else {
                                    tb += "<i style='margin-left:50px;color:red;' >已听评</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                                }
                            } else {
                                tb += "<i style='margin-left:50px;'>未评</i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                            }
                            tb += "<span>" + n.schoolRoomName + "  ·  " + n.teacherRealName + "</span>";
                            if (n.status == 0) {
                                tb += "<a href='javascript:void(0);' class='w_tab_btn w_live_btn'>未开始</a>";
                            } else if (n.status == 1) {
                                tb += "<a href=\"javascript:viewCourseLive('" + n.id + "','" + n.status + "','" + n.jie + "');\" class='w_tab_btn w_live_btn' >进入直播</a>";
                            } else if (n.status == 2) {
                                tb += "<a href=\"javascript:viewCourseLive('" + n.id + "','" + n.status + "','" + n.jie + "');\" class='w_tab_btn w_live_btn' >观看回放</a>";
                            } else {
                                tb += "<a href='javascript:void(0);' class='w_tab_btn w_live_btn'>未开始</a>";
                            }
                            tb += "</div>";
                            tb += "</li>";
                        })
                    }
                    $("#signleCourseList").html(tb);
                }
            })
            getViewUrl();
            if ('12073438' > 0) {

            } else {
                $("#mainDiv").html("<p style='color:white;font-size:17px;padding:250px;text-align:center;'>此课程上课教室没有录播设备</p>");
            }
        })

        var changeType = 0;

        function getViewUrl() {
                                                                                                                                                                                                                                        changeViewUrlHls();
            
        }

        function changeViewUrlHls() {

            if (checkStatusStudentHours()) {
                countdownTime();
                return;
            }

            jQuery.ajax({
                url: '/live/getViewUrlHls',
                type: 'get',
                data: {"liveId": '12073438', "status": '2', "jie": '', "isStudent": ''},
                success: function (data) {
                    // data = data.replace("newesxidian.chaoxing.com","newes.learning.xidian.edu.cn");
                                                                                                                                            

                    data = data.replace("/threepart/index-alihls.html", "/frontLive/playVideo");
                    
                    if (data.indexOf("m3u8") >= 0) {
                        $("#viewFrame").attr("src", data);
                        $("#zhezhao").hide();
                    } else {
                        // alert("联系信息中心/本科生院进行处理");
                        alert("视频回看生成中，需要1-3天处理完成，其他问题联系本科生院/信息中心进行处理");
                    }

                }
            })

        }

        function changeViewUrlRtmp() {

            if (checkStatusStudentHours()) {
                countdownTime();
                return;
            }

            jQuery.ajax({
                url: '/live/getViewUrl',
                type: 'get',
                data: {"liveId": '12073438', "status": '2', "jie": '', "isStudent": ''},
                success: function (data) {
                    // data = data.replace("newesxidian.chaoxing.com","newes.learning.xidian.edu.cn");
                    var curDomain = 'http://newesxidian.chaoxing.com';
                    console.log(curDomain)
                    data = data.replace("http://newes.learning.xidian.edu.cn", "https://newes.learning.xidian.edu.cn");
                    $("#viewFrame").attr("src", data);
                    $("#zhezhao").hide();
                }
            })

        }

        var type = 0;

        function changeOtherViewUrl() {

            if (checkStatusStudentHours()) {
                countdownTime();
                return;
            }

            if (type == 0) {
                $("#qiehuan").html("切换至加速模式");
                $("#qiehuan").css("color", "#fff");
                jQuery.ajax({
                    url: '/live/getYuanViewUrl',
                    type: 'get',
                    data: {"liveId": '12073438', "status": '2', "jie": '', "isStudent": ''},
                    success: function (data) {
                        // data = data.replace("newesxidian.chaoxing.com","newes.learning.xidian.edu.cn");
                        var curDomain = 'http://newesxidian.chaoxing.com';
                        console.log(curDomain)
                        if (curDomain == "http://newesxidian.chaoxing.com") {
                            console.log("11111")
                            data = data.replace("https", "http");
                        } else {
                            data = data.replace("http://newes.learning.xidian.edu.cn", "https://newes.learning.xidian.edu.cn");
                        }
                        $("#viewFrame").attr("src", data);
                        $("#zhezhao").hide();
                        type = 1;
                    }
                })
            } else {
                $("#qiehuan").html("切换源流播放");
                $("#qiehuan").css("color", "red");
                jQuery.ajax({
                    url: '/live/getViewUrlHls',
                    type: 'get',
                    data: {"liveId": '12073438', "status": '2', "jie": '', "isStudent": ''},
                    success: function (data) {
                        // data = data.replace("newesxidian.chaoxing.com","newes.learning.xidian.edu.cn");
                                                                                                                                                                                                $("#viewFrame").attr("src", data);
                        $("#zhezhao").hide();
                        type = 0;
                    }
                })

            }
        }

        function changeViewUrl(liveStatus) {
            $("#zhezhao").show();
            if (changeType == 0) {
                $("#qiehuan").html("切换至普通模式");
                $("#qiehuan").css("color", "#fff");
                changeType = 1;
                jQuery.ajax({
                    url: '/live/getViewUrlHls',
                    type: 'get',
                    data: {"liveId": '12073438', "status": '2', "jie": '', "isStudent": ''},
                    success: function (data) {
                        // data = data.replace("newesxidian.chaoxing.com","newes.learning.xidian.edu.cn");
                                                                                                                                                                                                $("#viewFrame").attr("src", data);
                        $("#zhezhao").hide();
                    }
                })
            } else {
                changeType = 0;
                if (1 == liveStatus) {
                    $("#qiehuan").html("切换播放源");
                } else {
                    $("#qiehuan").html("切换可拖拽");
                }
                $("#qiehuan").css("color", "red");
                jQuery.ajax({
                    url: '/live/getViewUrl',
                    type: 'get',
                    data: {"liveId": '12073438', "status": '2', "jie": '', "isStudent": ''},
                    success: function (data) {
                        // data = data.replace("newesxidian.chaoxing.com","newes.learning.xidian.edu.cn");
                        var curDomain = 'http://newesxidian.chaoxing.com';
                        console.log(curDomain)
                        if (curDomain == "http://newesxidian.chaoxing.com") {
                            console.log("11111")
                            data = data.replace("https", "http");
                        } else {
                            data = data.replace("http://newes.learning.xidian.edu.cn", "https://newes.learning.xidian.edu.cn");
                        }
                        $("#viewFrame").attr("src", data);
                        $("#zhezhao").hide();
                    }
                })
            }

        }
    </script>
</head>
<body style="zoom: 1;">
<div style="position: relative;">
    <div class="w_top_vidio">
        <div class="w_wrap">
                                                                                    <div class="fr w_show_btn"><a style="color:red;" id="qiehuan" href="javascript:void(0);" onclick="changeOtherViewUrl();">切换源流播放</a></div>&nbsp;&nbsp;&nbsp;&nbsp;
            <ul class="w_top_vidio_ul">
                <li style="display: none" id="countxs"><a href="javascript:void(0);"><i id="countdown" style="color: red"></i></a>
                </li>
                <li><a href="javascript:void(0);"><i class="">课程：</i>毛泽东思想和中国特色社会主义理论体系概论</a></li>
                <li><a href="javascript:void(0);">教师：代聆希</a></li>
                <li><a href="javascript:void(0);">教室：X-420</a></li>
                <li><a href="javascript:void(0);">班课：班级2MC00602128</a></li>
                <li><a href="javascript:void(0);">人数：99人</a></li>
                <li><a href="javascript:void(0);">上课时间：2025-05-20
                    &nbsp;&nbsp;&nbsp;&nbsp;排课周：1-16周</a></li>

            </ul>
        </div>
        <style>
            .wshow_menu {
                width: 35%;
                height: 526px;
                background-color: #fff;
                padding-bottom: 55px;
                border-bottom: 9px #303036 solid;
                top: 57px;
                left: 100%;
                position: absolute;
                display: none;
            }

            .close_btn {
                font-size: 5px;
                color: #fff;
            }

            .wque_swi {
                height: 40px;
                line-height: 40px;
                background: #333;
                color: #fff;
            }

            .wque_swi p {
                text-align: center;
                font-size: 16px;
            }

            .wque_swi .w_next {
                text-align: right;
            }

            .wque_swi .w_prev {
                text-align: left;
            }

            .wque_swi .w_center {
                text-align: center;
                width: 70%;
            }
        </style>
        <div class="wshow_menu" style="z-index:100;">
            <div class="wque_swi">
                <p class="fl w_prev" style="width:15%;visibility:hidden;">上一份</p>
                <p class="fl w_center" stlye="visibility:visible;">毛泽东思想和中国特色社会主义理论体系概论代聆希班级2MC00602128</p>
                <p class="fl w_next" style="width:15%;visibility:hidden;">下一份</p>
            </div>
            <iframe src="" width="100%" height="100%" style=" padding-bottom:9px;" frameborder="0" scrolling="yes" allowfullscreen="true" id="questionnaireIframe"></iframe>
        </div>
    </div>
</div>
<div class="w_main_vidio" style="height:590px;">
    <div class="w_wrap" style=" position:relative;">
        <div style="background:rgba(0,0,0,.8); position:absolute; left:0; top:50px; right:0; bottom:0;display:none;" id="zhezhao">
            <div style="text-align:center; padding-top: 250px; font-size:14px; color:#FFFFFF;">切换中</div>
        </div>
        <div class="w_main_top" style="height:510px;" id="mainDiv">
                        <iframe src="" width="100%" height="100%" frameborder="0" id="viewFrame" scrolling="no" allowfullscreen="true"></iframe>
        </div>
    </div>
    <div class="w_main_bot"></div>
</div>
<div class="w_vidio_foot">
    <div class="w_wrap">
        <div class="w_foot_top">
            <ul class="w_r_top clearf">
                <li class="w_r_top_li fl ">介绍</li>
                <li class="w_r_top_li fl w_curr_tit">目录</li>
            </ul>
        </div>
        <div class="w_foot_main">
            <div class="w_foot_course w_foot_cont">
                课程直播<br><br><br><br><br><br><br><br><br><br><br><br><br><br>
            </div>
            <ul class="w_foot_course w_foot_cont w_active" id="signleCourseList">
                                                                				    			    			    			    			    			    			    			    			                				                				                				                												                                				            </ul>
        </div>
    </div>
</div>

<script>
    var isShowQuestionnaire = 0;
    var questionPage = 1;
    /*课程非课程切换*/
    $(".w_r_top li").on("click", function () {
        $(this).addClass("w_curr_tit").siblings().removeClass("w_curr_tit");
        var index = $(this).index();
        $('.w_vidio_foot .w_foot_cont').eq(index).addClass('w_active').siblings().removeClass("w_active")
    })

    function viewCourseLive(liveId, status, jie) {
        console.log(106181);
                    window.location.href = "http://newesxidian.chaoxing.com/live/viewNewCourseLive1?liveId=" + liveId;
        
    }

    function showQuestionnaire() {
        questionPage = 1;
        if (isShowQuestionnaire == 0) {
            jQuery.ajax({
                url: "/frontLive/getLectureQuestionnaireList",
                type: "post",
                data: {
                    "fid": "16820",
                    "uId": "334850241",
                    "scheduleId": "106181",
                    "workScheduleId": "1650132"
                },
                dataType: "json",
                success: function (data) {
                    var iframeUrl = "/newesReception/questionnaireInfo?fid=16820&uId=334850241&grantId=&alreadyId=" + data.already.id + "&questionnaireId=" + data.already.questionnaireId + "&isLive=1";
                    $("#questionnaireIframe").attr("src", iframeUrl);
                    if (data.isAllHidden == 1) {
                        //$(".w_prev").css("visibility","hidden");
                        //$(".w_next").css("visibility","hidden");
                        //$(".w_prev").css("cursor","default");
                        //$(".w_next").css("cursor","default");
                        //$(".w_prev").attr("onclick","");
                        //$(".w_next").attr("onclick","");
                    } else {
                        //$(".w_prev").css("visibility","hidden");
                        //$(".w_next").css("visibility","visible");
                        //$(".w_prev").css("cursor","default");
                        //$(".w_next").css("cursor","pointer");
                        //$(".w_prev").attr("onclick","");
                        //$(".w_next").attr("onclick","changeQuestionnaire(2)");
                    }
                }
            });

            isShowQuestionnaire = 1;
            $("#showOptions").html("隐藏问卷");
            $(".wshow_menu").css("display", "block");
            $(".wshow_menu").animate({left: '65%'}, '500');
            $(".w_main_vidio").css("width", "65%");
            $(".w_vidio_foot").css("width", "65%");
        } else {
            isShowQuestionnaire = 0;
            //event.preventDefault();
            $("#showOptions").html("显示问卷");
            $(".wshow_menu").animate({left: '100%'}, '500');
            $(".w_main_vidio").css("width", "100%");
            $(".w_vidio_foot").css("width", "100%");
            $(".wshow_menu").css("display", "none");
        }
    }

    function changeQuestionnaire(type) {
        if (type == 1) {
            questionPage = questionPage - 1;
        } else {
            questionPage = questionPage + 1;
        }
        jQuery.ajax({
            url: "/frontLive/getLectureQuestionnaireList",
            type: "post",
            data: {
                "fid": "16820",
                "uId": "334850241",
                "scheduleId": "106181",
                "workScheduleId": "1650132",
                "questionnairePage": questionPage
            },
            dataType: "json",
            success: function (data) {
                var iframeUrl = "/newesReception/questionnaireInfo?fid=16820&uId=334850241&grantId=&alreadyId=" + data.already.id + "&questionnaireId=" + data.already.questionnaireId + "&isLive=1";
                $("#questionnaireIframe").attr("src", iframeUrl);
                if (data.isAllHidden == 1) {
                    $(".w_prev").css("visibility", "hidden");
                    $(".w_next").css("visibility", "hidden");
                    $(".w_prev").css("cursor", "default");
                    $(".w_next").css("cursor", "default");
                    $(".w_prev").attr("onclick", "");
                    $(".w_next").attr("onclick", "");
                } else {
                    if (data.pageStatus == 1) {
                        $(".w_prev").css("visibility", "hidden");
                        $(".w_next").css("visibility", "visible");
                        $(".w_prev").css("cursor", "default");
                        $(".w_next").css("cursor", "pointer");
                        $(".w_prev").attr("onclick", "");
                        $(".w_next").attr("onclick", "changeQuestionnaire(2)");
                    } else if (data.pageStatus == 2) {
                        $(".w_prev").css("visibility", "visible");
                        $(".w_next").css("visibility", "visible");
                        $(".w_prev").css("cursor", "pointer");
                        $(".w_next").css("cursor", "pointer");
                        $(".w_prev").attr("onclick", "changeQuestionnaire(1)");
                        $(".w_next").attr("onclick", "changeQuestionnaire(2)");
                    } else {
                        $(".w_prev").css("visibility", "visible");
                        $(".w_next").css("visibility", "hidden");
                        $(".w_prev").css("cursor", "pointer");
                        $(".w_next").css("cursor", "default");
                        $(".w_prev").attr("onclick", "changeQuestionnaire(1)");
                        $(".w_next").attr("onclick", "");
                    }
                }
            }
        });
    }

    function clearTop() {
        $(".w_prev").css("visibility", "hidden");
        $(".w_next").css("visibility", "hidden");
        $(".w_prev").css("cursor", "default");
        $(".w_next").css("cursor", "default");
        $(".w_prev").attr("onclick", "");
        $(".w_next").attr("onclick", "");
    }


    //校验是否到上课时间
    function checkStatusStudentHours() {
        var status = "2";
        //如果是督导不限制
        var isSupervision = "0";
        if ("1" == isSupervision) {
            return false;
        }
        return status == "0";
    }


    function countdownTime() {
        var starttime = "";
        $("#viewFrame").attr("src", "/live/countdownpage?starttime=" + starttime);

    }

    //心跳重新加载流
    function reloadStream() {
        if (!checkStatusStudentHours()) {
            return;
        }
        if ("" == "") {
            console.log("countdownNum is null")
            return;
        }
        var countdown = Number("");
        countdown++;
        var clock = window.setInterval(function () {
            countdown = countdown - 5;
            // console.log(countdown)
            if (countdown == 0) {
                window.clearInterval(clock);
                getViewUrl();
            }
        }, 5000)

    }


</script>
</body></html>